package keeto.com.vn.bms.ui.adapter;

import java.util.List;

import keeto.com.vn.bms.ui.activity.R;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;

public class MySpinnerAdapter extends ArrayAdapter<String> {
	private Context context;
	LayoutInflater inflater;
	List<String> list;

	public MySpinnerAdapter(Context context, List<String> objects) {
		super(context, 0, objects);
		this.context = context;
		this.inflater = LayoutInflater.from(context);
		this.list = objects;
	}
	@Override
	public View getDropDownView(int position, View convertView, ViewGroup parent) {
		return getCustomView(position, convertView, parent);
	}
	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		return getCustomView(position, convertView, parent);
	}

	public View getCustomView(int position, View convertView, ViewGroup parent) {
		View mySpinner = inflater.inflate(R.layout.custom_spinner, parent,false);
		TextView text1 = (TextView) mySpinner.findViewById(R.id.text1);
		text1.setText(list.get(position));
		return mySpinner;
	}
	
}
